package com.lib.util;

import android.app.Application;
import android.graphics.drawable.Drawable;
import androidx.annotation.ColorRes;
import androidx.annotation.DimenRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;

/**
 * @author qinbaowei
 * @createtime 2017/04/14 16:28
 * @email qbaowei@qq.com
 * @description
 */

public class ResUtil {

    private static Application sApplication;

    public static void init(Application application) {
        sApplication = application;
    }

    public static String getString(@StringRes int resId) {
        return sApplication.getResources().getString(resId);
    }

    public static int getDimension(@DimenRes int resId) {
        return (int) sApplication.getResources().getDimension(resId);
    }

    public static Drawable getDrawable(@DrawableRes int resId) {
        return sApplication.getResources().getDrawable(resId);
    }

    public static int getColor(@ColorRes int resId) {
        return sApplication.getResources().getColor(resId);
    }
}
